/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: eventmesh-client.proto

package org.apache.eventmesh.common.protocol.grpc.protos;

import java.util.Objects;

import com.google.protobuf.ByteString;

/**
 * Protobuf type {@code eventmesh.common.protocol.grpc.BatchMessage}
 */
@SuppressWarnings({"all"})
public final class BatchMessage extends
        com.google.protobuf.GeneratedMessageV3 implements
        // @@protoc_insertion_point(message_implements:eventmesh.common.protocol.grpc.BatchMessage)
        BatchMessageOrBuilder {
    private static final long serialVersionUID = -3876605571602481461L;

    // Use BatchMessage.newBuilder() to construct.
    private BatchMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
    }

    private BatchMessage() {
        producerGroup_ = "";
        topic_ = "";
        messageItem_ = java.util.Collections.emptyList();
    }

    @Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
        return this.unknownFields;
    }

    private BatchMessage(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
        this();
        if (extensionRegistry == null) {
            throw new NullPointerException();
        }
        int mutable_bitField0_ = 0;
        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
                com.google.protobuf.UnknownFieldSet.newBuilder();
        try {
            boolean done = false;
            while (!done) {
                int tag = input.readTag();
                switch (tag) {
                    case 0:
                        done = true;
                        break;
                    default: {
                        if (!parseUnknownFieldProto3(
                                input, unknownFields, extensionRegistry, tag)) {
                            done = true;
                        }
                        break;
                    }
                    case 10: {
                        RequestHeader.Builder subBuilder = null;
                        if (header_ != null) {
                            subBuilder = header_.toBuilder();
                        }
                        header_ = input.readMessage(RequestHeader.parser(), extensionRegistry);
                        if (subBuilder != null) {
                            subBuilder.mergeFrom(header_);
                            header_ = subBuilder.buildPartial();
                        }

                        break;
                    }
                    case 18: {
                        producerGroup_ = input.readStringRequireUtf8();
                        break;
                    }
                    case 26: {
                        topic_ = input.readStringRequireUtf8();
                        break;
                    }
                    case 34: {
                        if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                            messageItem_ = new java.util.ArrayList<MessageItem>();
                            mutable_bitField0_ |= 0x00000008;
                        }
                        messageItem_.add(
                                input.readMessage(MessageItem.parser(), extensionRegistry));
                        break;
                    }
                }
            }
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(
                    e).setUnfinishedMessage(this);
        } finally {
            if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                messageItem_ = java.util.Collections.unmodifiableList(messageItem_);
            }
            this.unknownFields = unknownFields.build();
            makeExtensionsImmutable();
        }
    }

    public static final com.google.protobuf.Descriptors.Descriptor
    getDescriptor() {
        return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_descriptor;
    }

    protected FieldAccessorTable
    internalGetFieldAccessorTable() {
        return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_fieldAccessorTable
                .ensureFieldAccessorsInitialized(
                        BatchMessage.class, Builder.class);
    }

    public interface MessageItemOrBuilder extends
            // @@protoc_insertion_point(interface_extends:eventmesh.common.protocol.grpc.BatchMessage.MessageItem)
            com.google.protobuf.MessageOrBuilder {

        /**
         * <code>string content = 1;</code>
         */
        String getContent();

        /**
         * <code>string content = 1;</code>
         */
        com.google.protobuf.ByteString
        getContentBytes();

        /**
         * <code>string ttl = 2;</code>
         */
        String getTtl();

        /**
         * <code>string ttl = 2;</code>
         */
        com.google.protobuf.ByteString
        getTtlBytes();

        /**
         * <code>string uniqueId = 3;</code>
         */
        String getUniqueId();

        /**
         * <code>string uniqueId = 3;</code>
         */
        com.google.protobuf.ByteString
        getUniqueIdBytes();

        /**
         * <code>string seqNum = 4;</code>
         */
        String getSeqNum();

        /**
         * <code>string seqNum = 4;</code>
         */
        com.google.protobuf.ByteString
        getSeqNumBytes();

        /**
         * <code>string tag = 5;</code>
         */
        String getTag();

        /**
         * <code>string tag = 5;</code>
         */
        com.google.protobuf.ByteString
        getTagBytes();

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */
        int getPropertiesCount();

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */
        boolean containsProperties(
                String key);

        /**
         * Use {@link #getPropertiesMap()} instead.
         */
        @Deprecated
        java.util.Map<String, String>
        getProperties();

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */
        java.util.Map<String, String>
        getPropertiesMap();

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */

        String getPropertiesOrDefault(
                String key,
                String defaultValue);

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */

        String getPropertiesOrThrow(
                String key);
    }

    /**
     * Protobuf type {@code eventmesh.common.protocol.grpc.BatchMessage.MessageItem}
     */
    public static final class MessageItem extends
            com.google.protobuf.GeneratedMessageV3 implements
            // @@protoc_insertion_point(message_implements:eventmesh.common.protocol.grpc.BatchMessage.MessageItem)
            MessageItemOrBuilder {
        private static final long serialVersionUID = -6677110210488831851L;

        // Use MessageItem.newBuilder() to construct.
        private MessageItem(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
            super(builder);
        }

        private MessageItem() {
            content_ = "";
            ttl_ = "";
            uniqueId_ = "";
            seqNum_ = "";
            tag_ = "";
        }

        @Override
        public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
            return this.unknownFields;
        }

        private MessageItem(
                com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            this();
            if (extensionRegistry == null) {
                throw new NullPointerException();
            }
            int mutable_bitField0_ = 0;
            com.google.protobuf.UnknownFieldSet.Builder unknownFields =
                    com.google.protobuf.UnknownFieldSet.newBuilder();
            try {
                boolean done = false;
                while (!done) {
                    int tag = input.readTag();
                    switch (tag) {
                        case 0:
                            done = true;
                            break;
                        default: {
                            if (!parseUnknownFieldProto3(
                                    input, unknownFields, extensionRegistry, tag)) {
                                done = true;
                            }
                            break;
                        }
                        case 10: {
                            content_ = input.readStringRequireUtf8();
                            break;
                        }
                        case 18: {
                            ttl_ = input.readStringRequireUtf8();
                            break;
                        }
                        case 26: {
                            uniqueId_ = input.readStringRequireUtf8();
                            break;
                        }
                        case 34: {
                            seqNum_ = input.readStringRequireUtf8();
                            break;
                        }
                        case 42: {
                            tag_ = input.readStringRequireUtf8();
                            break;
                        }
                        case 50: {
                            if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
                                properties_ = com.google.protobuf.MapField.newMapField(
                                        PropertiesDefaultEntryHolder.defaultEntry);
                                mutable_bitField0_ |= 0x00000020;
                            }
                            com.google.protobuf.MapEntry<String, String>
                                    properties__ = input.readMessage(
                                    PropertiesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
                            properties_.getMutableMap().put(
                                    properties__.getKey(), properties__.getValue());
                            break;
                        }
                    }
                }
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                throw e.setUnfinishedMessage(this);
            } catch (java.io.IOException e) {
                throw new com.google.protobuf.InvalidProtocolBufferException(
                        e).setUnfinishedMessage(this);
            } finally {
                this.unknownFields = unknownFields.build();
                makeExtensionsImmutable();
            }
        }

        public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
            return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_MessageItem_descriptor;
        }

        @SuppressWarnings({"rawtypes"})
        protected com.google.protobuf.MapField internalGetMapField(
                int number) {
            switch (number) {
                case 6:
                    return internalGetProperties();
                default:
                    throw new RuntimeException(
                            "Invalid map field number: " + number);
            }
        }

        protected FieldAccessorTable
        internalGetFieldAccessorTable() {
            return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_MessageItem_fieldAccessorTable
                    .ensureFieldAccessorsInitialized(
                            MessageItem.class, Builder.class);
        }

        private int bitField0_;
        public static final int CONTENT_FIELD_NUMBER = 1;
        private volatile String content_;

        /**
         * <code>string content = 1;</code>
         */
        public String getContent() {
            return content_;
        }

        /**
         * <code>string content = 1;</code>
         */
        public com.google.protobuf.ByteString
        getContentBytes() {
            return ByteString.copyFromUtf8(content_);
        }

        public static final int TTL_FIELD_NUMBER = 2;
        private volatile String ttl_;

        /**
         * <code>string ttl = 2;</code>
         */
        public String getTtl() {
            return ttl_;
        }

        /**
         * <code>string ttl = 2;</code>
         */
        public com.google.protobuf.ByteString
        getTtlBytes() {
            return ByteString.copyFromUtf8(ttl_);
        }

        public static final int UNIQUEID_FIELD_NUMBER = 3;
        private volatile String uniqueId_;

        /**
         * <code>string uniqueId = 3;</code>
         */
        public String getUniqueId() {
            return uniqueId_;
        }

        /**
         * <code>string uniqueId = 3;</code>
         */
        public com.google.protobuf.ByteString
        getUniqueIdBytes() {
            return ByteString.copyFromUtf8(uniqueId_);
        }

        public static final int SEQNUM_FIELD_NUMBER = 4;
        private volatile String seqNum_;

        /**
         * <code>string seqNum = 4;</code>
         */
        public String getSeqNum() {
            return seqNum_;
        }

        /**
         * <code>string seqNum = 4;</code>
         */
        public com.google.protobuf.ByteString
        getSeqNumBytes() {
            return ByteString.copyFromUtf8(seqNum_);
        }

        public static final int TAG_FIELD_NUMBER = 5;
        private volatile String tag_;

        /**
         * <code>string tag = 5;</code>
         */
        public String getTag() {
            return tag_;
        }

        /**
         * <code>string tag = 5;</code>
         */
        public com.google.protobuf.ByteString
        getTagBytes() {
            return ByteString.copyFromUtf8(tag_);
        }

        public static final int PROPERTIES_FIELD_NUMBER = 6;

        private static final class PropertiesDefaultEntryHolder {
            static final com.google.protobuf.MapEntry<
                    String, String> defaultEntry =
                    com.google.protobuf.MapEntry
                            .<String, String>newDefaultInstance(
                                    EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_MessageItem_PropertiesEntry_descriptor,
                                    com.google.protobuf.WireFormat.FieldType.STRING,
                                    "",
                                    com.google.protobuf.WireFormat.FieldType.STRING,
                                    "");
        }

        private com.google.protobuf.MapField<
                String, String> properties_;

        private com.google.protobuf.MapField<String, String>
        internalGetProperties() {
            if (properties_ == null) {
                return com.google.protobuf.MapField.emptyMapField(
                        PropertiesDefaultEntryHolder.defaultEntry);
            }
            return properties_;
        }

        public int getPropertiesCount() {
            return internalGetProperties().getMap().size();
        }

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */

        public boolean containsProperties(
                String key) {
            Objects.requireNonNull(key, "key can not be null");

            return internalGetProperties().getMap().containsKey(key);
        }

        /**
         * Use {@link #getPropertiesMap()} instead.
         */
        @Deprecated
        public java.util.Map<String, String> getProperties() {
            return getPropertiesMap();
        }

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */

        public java.util.Map<String, String> getPropertiesMap() {
            return internalGetProperties().getMap();
        }

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */

        public String getPropertiesOrDefault(
                String key,
                String defaultValue) {
            Objects.requireNonNull(key, "key can not be null");

            java.util.Map<String, String> map =
                    internalGetProperties().getMap();
            String value = map.get(key);
            if (value == null) return defaultValue;
            return value;
        }

        /**
         * <code>map&lt;string, string&gt; properties = 6;</code>
         */

        public String getPropertiesOrThrow(
                String key) {
            Objects.requireNonNull(key, "key can not be null");

            java.util.Map<String, String> map =
                    internalGetProperties().getMap();
            if (!map.containsKey(key)) {
                throw new IllegalArgumentException();
            }
            return map.get(key);
        }

        private byte memoizedIsInitialized = -1;

        public final boolean isInitialized() {
            if (memoizedIsInitialized == 1) return true;
            if (memoizedIsInitialized == 0) return false;

            memoizedIsInitialized = 1;
            return true;
        }

        public void writeTo(com.google.protobuf.CodedOutputStream output)
                throws java.io.IOException {
            if (!getContentBytes().isEmpty()) {
                com.google.protobuf.GeneratedMessageV3.writeString(output, 1, content_);
            }
            if (!getTtlBytes().isEmpty()) {
                com.google.protobuf.GeneratedMessageV3.writeString(output, 2, ttl_);
            }
            if (!getUniqueIdBytes().isEmpty()) {
                com.google.protobuf.GeneratedMessageV3.writeString(output, 3, uniqueId_);
            }
            if (!getSeqNumBytes().isEmpty()) {
                com.google.protobuf.GeneratedMessageV3.writeString(output, 4, seqNum_);
            }
            if (!getTagBytes().isEmpty()) {
                com.google.protobuf.GeneratedMessageV3.writeString(output, 5, tag_);
            }
            com.google.protobuf.GeneratedMessageV3
                    .serializeStringMapTo(
                            output,
                            internalGetProperties(),
                            PropertiesDefaultEntryHolder.defaultEntry,
                            6);
            unknownFields.writeTo(output);
        }

        public int getSerializedSize() {
            int size = memoizedSize;
            if (size != -1) return size;

            size = 0;
            if (!getContentBytes().isEmpty()) {
                size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, content_);
            }
            if (!getTtlBytes().isEmpty()) {
                size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, ttl_);
            }
            if (!getUniqueIdBytes().isEmpty()) {
                size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, uniqueId_);
            }
            if (!getSeqNumBytes().isEmpty()) {
                size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, seqNum_);
            }
            if (!getTagBytes().isEmpty()) {
                size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, tag_);
            }
            for (java.util.Map.Entry<String, String> entry
                    : internalGetProperties().getMap().entrySet()) {
                com.google.protobuf.MapEntry<String, String>
                        properties__ = PropertiesDefaultEntryHolder.defaultEntry.newBuilderForType()
                        .setKey(entry.getKey())
                        .setValue(entry.getValue())
                        .build();
                size += com.google.protobuf.CodedOutputStream
                        .computeMessageSize(6, properties__);
            }
            size += unknownFields.getSerializedSize();
            memoizedSize = size;
            return size;
        }

        @Override
        public boolean equals(final Object obj) {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof MessageItem)) {
                return super.equals(obj);
            }
            MessageItem other = (MessageItem) obj;

            return getContent()
                    .equals(other.getContent())
                    && getTtl()
                    .equals(other.getTtl())
                    && getUniqueId()
                    .equals(other.getUniqueId())
                    && getSeqNum()
                    .equals(other.getSeqNum())
                    && getTag()
                    .equals(other.getTag())
                    && internalGetProperties().equals(
                    other.internalGetProperties())
                    && unknownFields.equals(other.unknownFields);
        }

        @Override
        public int hashCode() {
            if (memoizedHashCode != 0) {
                return memoizedHashCode;
            }
            int hash = 41;
            hash = (19 * hash) + getDescriptor().hashCode();
            hash = (37 * hash) + CONTENT_FIELD_NUMBER;
            hash = (53 * hash) + getContent().hashCode();
            hash = (37 * hash) + TTL_FIELD_NUMBER;
            hash = (53 * hash) + getTtl().hashCode();
            hash = (37 * hash) + UNIQUEID_FIELD_NUMBER;
            hash = (53 * hash) + getUniqueId().hashCode();
            hash = (37 * hash) + SEQNUM_FIELD_NUMBER;
            hash = (53 * hash) + getSeqNum().hashCode();
            hash = (37 * hash) + TAG_FIELD_NUMBER;
            hash = (53 * hash) + getTag().hashCode();
            if (!internalGetProperties().getMap().isEmpty()) {
                hash = (37 * hash) + PROPERTIES_FIELD_NUMBER;
                hash = (53 * hash) + internalGetProperties().hashCode();
            }
            hash = (29 * hash) + unknownFields.hashCode();
            memoizedHashCode = hash;
            return hash;
        }

        public static MessageItem parseFrom(
                java.nio.ByteBuffer data)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static MessageItem parseFrom(
                java.nio.ByteBuffer data,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static MessageItem parseFrom(
                com.google.protobuf.ByteString data)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static MessageItem parseFrom(
                com.google.protobuf.ByteString data,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static MessageItem parseFrom(byte[] data)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data);
        }

        public static MessageItem parseFrom(
                byte[] data,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return PARSER.parseFrom(data, extensionRegistry);
        }

        public static MessageItem parseFrom(java.io.InputStream input)
                throws java.io.IOException {
            return com.google.protobuf.GeneratedMessageV3
                    .parseWithIOException(PARSER, input);
        }

        public static MessageItem parseFrom(
                java.io.InputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return com.google.protobuf.GeneratedMessageV3
                    .parseWithIOException(PARSER, input, extensionRegistry);
        }

        public static MessageItem parseDelimitedFrom(java.io.InputStream input)
                throws java.io.IOException {
            return com.google.protobuf.GeneratedMessageV3
                    .parseDelimitedWithIOException(PARSER, input);
        }

        public static MessageItem parseDelimitedFrom(
                java.io.InputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return com.google.protobuf.GeneratedMessageV3
                    .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
        }

        public static MessageItem parseFrom(
                com.google.protobuf.CodedInputStream input)
                throws java.io.IOException {
            return com.google.protobuf.GeneratedMessageV3
                    .parseWithIOException(PARSER, input);
        }

        public static MessageItem parseFrom(
                com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            return com.google.protobuf.GeneratedMessageV3
                    .parseWithIOException(PARSER, input, extensionRegistry);
        }

        public Builder newBuilderForType() {
            return newBuilder();
        }

        public static Builder newBuilder() {
            return DEFAULT_INSTANCE.toBuilder();
        }

        public static Builder newBuilder(MessageItem prototype) {
            return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
        }

        public Builder toBuilder() {
            return this == DEFAULT_INSTANCE
                    ? new Builder() : new Builder().mergeFrom(this);
        }

        @Override
        protected Builder newBuilderForType(
                BuilderParent parent) {
            return new Builder(parent);
        }

        /**
         * Protobuf type {@code eventmesh.common.protocol.grpc.BatchMessage.MessageItem}
         */
        public static final class Builder extends
                com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
                // @@protoc_insertion_point(builder_implements:eventmesh.common.protocol.grpc.BatchMessage.MessageItem)
                MessageItemOrBuilder {
            public static final com.google.protobuf.Descriptors.Descriptor
            getDescriptor() {
                return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_MessageItem_descriptor;
            }

            @SuppressWarnings({"rawtypes"})
            protected com.google.protobuf.MapField internalGetMapField(
                    int number) {
                switch (number) {
                    case 6:
                        return internalGetProperties();
                    default:
                        throw new RuntimeException(
                                "Invalid map field number: " + number);
                }
            }

            @SuppressWarnings({"rawtypes"})
            protected com.google.protobuf.MapField internalGetMutableMapField(
                    int number) {
                switch (number) {
                    case 6:
                        return internalGetMutableProperties();
                    default:
                        throw new RuntimeException(
                                "Invalid map field number: " + number);
                }
            }

            protected FieldAccessorTable
            internalGetFieldAccessorTable() {
                return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_MessageItem_fieldAccessorTable
                        .ensureFieldAccessorsInitialized(
                                MessageItem.class, Builder.class);
            }

            // Construct using org.apache.eventmesh.common.protocol.grpc.protos.BatchMessage.MessageItem.newBuilder()
            private Builder() {
                maybeForceBuilderInitialization();
            }

            private Builder(BuilderParent parent) {
                super(parent);
                maybeForceBuilderInitialization();
            }

            private void maybeForceBuilderInitialization() {
                if (com.google.protobuf.GeneratedMessageV3
                        .alwaysUseFieldBuilders) {
                }
            }

            public Builder clear() {
                super.clear();
                content_ = "";
                ttl_ = "";
                uniqueId_ = "";
                seqNum_ = "";
                tag_ = "";
                internalGetMutableProperties().clear();
                return this;
            }

            public com.google.protobuf.Descriptors.Descriptor
            getDescriptorForType() {
                return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_MessageItem_descriptor;
            }

            public MessageItem getDefaultInstanceForType() {
                return MessageItem.getDefaultInstance();
            }

            public MessageItem build() {
                MessageItem result = buildPartial();
                if (!result.isInitialized()) {
                    throw newUninitializedMessageException(result);
                }
                return result;
            }

            public MessageItem buildPartial() {
                MessageItem result = new MessageItem(this);
                int from_bitField0_ = bitField0_;
                int to_bitField0_ = 0;
                result.content_ = content_;
                result.ttl_ = ttl_;
                result.uniqueId_ = uniqueId_;
                result.seqNum_ = seqNum_;
                result.tag_ = tag_;
                result.properties_ = internalGetProperties();
                result.properties_.makeImmutable();
                result.bitField0_ = to_bitField0_;
                onBuilt();
                return result;
            }

            public Builder clone() {
                return (Builder) super.clone();
            }

            public Builder setField(
                    com.google.protobuf.Descriptors.FieldDescriptor field,
                    Object value) {
                return (Builder) super.setField(field, value);
            }

            public Builder clearField(
                    com.google.protobuf.Descriptors.FieldDescriptor field) {
                return (Builder) super.clearField(field);
            }

            public Builder clearOneof(
                    com.google.protobuf.Descriptors.OneofDescriptor oneof) {
                return (Builder) super.clearOneof(oneof);
            }

            public Builder setRepeatedField(
                    com.google.protobuf.Descriptors.FieldDescriptor field,
                    int index, Object value) {
                return (Builder) super.setRepeatedField(field, index, value);
            }

            public Builder addRepeatedField(
                    com.google.protobuf.Descriptors.FieldDescriptor field,
                    Object value) {
                return (Builder) super.addRepeatedField(field, value);
            }

            public Builder mergeFrom(com.google.protobuf.Message other) {
                if (other instanceof MessageItem) {
                    return mergeFrom((MessageItem) other);
                } else {
                    super.mergeFrom(other);
                    return this;
                }
            }

            public Builder mergeFrom(MessageItem other) {
                if (other == MessageItem.getDefaultInstance()) return this;
                if (!other.getContent().isEmpty()) {
                    content_ = other.content_;
                    onChanged();
                }
                if (!other.getTtl().isEmpty()) {
                    ttl_ = other.ttl_;
                    onChanged();
                }
                if (!other.getUniqueId().isEmpty()) {
                    uniqueId_ = other.uniqueId_;
                    onChanged();
                }
                if (!other.getSeqNum().isEmpty()) {
                    seqNum_ = other.seqNum_;
                    onChanged();
                }
                if (!other.getTag().isEmpty()) {
                    tag_ = other.tag_;
                    onChanged();
                }
                internalGetMutableProperties().mergeFrom(
                        other.internalGetProperties());
                this.mergeUnknownFields(other.unknownFields);
                onChanged();
                return this;
            }

            public final boolean isInitialized() {
                return true;
            }

            public Builder mergeFrom(
                    com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws java.io.IOException {
                MessageItem parsedMessage = null;
                try {
                    parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
                } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                    parsedMessage = (MessageItem) e.getUnfinishedMessage();
                    throw e.unwrapIOException();
                } finally {
                    if (parsedMessage != null) {
                        mergeFrom(parsedMessage);
                    }
                }
                return this;
            }

            private int bitField0_;

            private String content_ = "";

            /**
             * <code>string content = 1;</code>
             */
            public String getContent() {
                return content_;
            }

            /**
             * <code>string content = 1;</code>
             */
            public com.google.protobuf.ByteString
            getContentBytes() {
                return ByteString.copyFromUtf8(content_);
            }

            /**
             * <code>string content = 1;</code>
             */
            public Builder setContent(
                    String value) {
                Objects.requireNonNull(value, "content can not be null");

                content_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>string content = 1;</code>
             */
            public Builder clearContent() {

                content_ = getDefaultInstance().getContent();
                onChanged();
                return this;
            }

            /**
             * <code>string content = 1;</code>
             */
            public Builder setContentBytes(
                    com.google.protobuf.ByteString value) {
                Objects.requireNonNull(value, "ContentBytes can not be null");
                checkByteStringIsUtf8(value);

                content_ = value.toStringUtf8();
                onChanged();
                return this;
            }

            private String ttl_ = "";

            /**
             * <code>string ttl = 2;</code>
             */
            public String getTtl() {
                return ttl_;
            }

            /**
             * <code>string ttl = 2;</code>
             */
            public com.google.protobuf.ByteString
            getTtlBytes() {
                return ByteString.copyFromUtf8(ttl_);
            }

            /**
             * <code>string ttl = 2;</code>
             */
            public Builder setTtl(
                    String value) {
                Objects.requireNonNull(value, "ttl can not be null");

                ttl_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>string ttl = 2;</code>
             */
            public Builder clearTtl() {

                ttl_ = getDefaultInstance().getTtl();
                onChanged();
                return this;
            }

            /**
             * <code>string ttl = 2;</code>
             */
            public Builder setTtlBytes(
                    com.google.protobuf.ByteString value) {
                Objects.requireNonNull(value, "TtlBytes can not be null");
                checkByteStringIsUtf8(value);

                ttl_ = value.toStringUtf8();
                onChanged();
                return this;
            }

            private String uniqueId_ = "";

            /**
             * <code>string uniqueId = 3;</code>
             */
            public String getUniqueId() {
                return uniqueId_;
            }

            /**
             * <code>string uniqueId = 3;</code>
             */
            public com.google.protobuf.ByteString
            getUniqueIdBytes() {
                return ByteString.copyFromUtf8(uniqueId_);
            }

            /**
             * <code>string uniqueId = 3;</code>
             */
            public Builder setUniqueId(
                    String value) {
                Objects.requireNonNull(value, "uniqueId_ can not be null");

                uniqueId_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>string uniqueId = 3;</code>
             */
            public Builder clearUniqueId() {

                uniqueId_ = getDefaultInstance().getUniqueId();
                onChanged();
                return this;
            }

            /**
             * <code>string uniqueId = 3;</code>
             */
            public Builder setUniqueIdBytes(
                    com.google.protobuf.ByteString value) {
                Objects.requireNonNull(value, "UniqueIdBytes can not be null");
                checkByteStringIsUtf8(value);

                uniqueId_ = value.toStringUtf8();
                onChanged();
                return this;
            }

            private String seqNum_ = "";

            /**
             * <code>string seqNum = 4;</code>
             */
            public String getSeqNum() {
                return seqNum_;
            }

            /**
             * <code>string seqNum = 4;</code>
             */
            public com.google.protobuf.ByteString
            getSeqNumBytes() {
                return ByteString.copyFromUtf8(seqNum_);
            }

            /**
             * <code>string seqNum = 4;</code>
             */
            public Builder setSeqNum(
                    String value) {
                Objects.requireNonNull(value, "SeqNum can not be null");

                seqNum_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>string seqNum = 4;</code>
             */
            public Builder clearSeqNum() {

                seqNum_ = getDefaultInstance().getSeqNum();
                onChanged();
                return this;
            }

            /**
             * <code>string seqNum = 4;</code>
             */
            public Builder setSeqNumBytes(
                    com.google.protobuf.ByteString value) {
                Objects.requireNonNull(value, "SeqNumBytes can not be null");
                checkByteStringIsUtf8(value);

                seqNum_ = value.toStringUtf8();
                onChanged();
                return this;
            }

            private String tag_ = "";

            /**
             * <code>string tag = 5;</code>
             */
            public String getTag() {
                return tag_;
            }

            /**
             * <code>string tag = 5;</code>
             */
            public com.google.protobuf.ByteString
            getTagBytes() {
                return ByteString.copyFromUtf8(tag_);
            }

            /**
             * <code>string tag = 5;</code>
             */
            public Builder setTag(
                    String value) {
                Objects.requireNonNull(value, "tag can not be null");

                tag_ = value;
                onChanged();
                return this;
            }

            /**
             * <code>string tag = 5;</code>
             */
            public Builder clearTag() {

                tag_ = getDefaultInstance().getTag();
                onChanged();
                return this;
            }

            /**
             * <code>string tag = 5;</code>
             */
            public Builder setTagBytes(
                    com.google.protobuf.ByteString value) {
                Objects.requireNonNull(value, "TagBytes can not be null");
                checkByteStringIsUtf8(value);

                tag_ = value.toStringUtf8();
                onChanged();
                return this;
            }

            private com.google.protobuf.MapField<
                    String, String> properties_;

            private com.google.protobuf.MapField<String, String>
            internalGetProperties() {
                if (properties_ == null) {
                    return com.google.protobuf.MapField.emptyMapField(
                            PropertiesDefaultEntryHolder.defaultEntry);
                }
                return properties_;
            }

            private com.google.protobuf.MapField<String, String>
            internalGetMutableProperties() {
                onChanged();
                ;
                if (properties_ == null) {
                    properties_ = com.google.protobuf.MapField.newMapField(
                            PropertiesDefaultEntryHolder.defaultEntry);
                }
                if (!properties_.isMutable()) {
                    properties_ = properties_.copy();
                }
                return properties_;
            }

            public int getPropertiesCount() {
                return internalGetProperties().getMap().size();
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */

            public boolean containsProperties(
                    String key) {
                Objects.requireNonNull(key, "key can not be null");

                return internalGetProperties().getMap().containsKey(key);
            }

            /**
             * Use {@link #getPropertiesMap()} instead.
             */
            @Deprecated
            public java.util.Map<String, String> getProperties() {
                return getPropertiesMap();
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */

            public java.util.Map<String, String> getPropertiesMap() {
                return internalGetProperties().getMap();
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */

            public String getPropertiesOrDefault(
                    String key,
                    String defaultValue) {
                Objects.requireNonNull(key, "key can not be null");

                java.util.Map<String, String> map =
                        internalGetProperties().getMap();
                String value = map.get(key);
                if (value == null) return defaultValue;
                return value;
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */

            public String getPropertiesOrThrow(
                    String key) {
                Objects.requireNonNull(key, "key can not be null");

                java.util.Map<String, String> map =
                        internalGetProperties().getMap();
                if (!map.containsKey(key)) {
                    throw new IllegalArgumentException();
                }
                return map.get(key);
            }

            public Builder clearProperties() {
                internalGetMutableProperties().getMutableMap()
                        .clear();
                return this;
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */

            public Builder removeProperties(
                    String key) {
                Objects.requireNonNull(key, "key can not be null");

                internalGetMutableProperties().getMutableMap()
                        .remove(key);
                return this;
            }

            /**
             * Use alternate mutation accessors instead.
             */
            @Deprecated
            public java.util.Map<String, String>
            getMutableProperties() {
                return internalGetMutableProperties().getMutableMap();
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */
            public Builder putProperties(
                    String key,
                    String value) {
                Objects.requireNonNull(key, "key can not be null");
                Objects.requireNonNull(value, "value can not be null");

                internalGetMutableProperties().getMutableMap()
                        .put(key, value);
                return this;
            }

            /**
             * <code>map&lt;string, string&gt; properties = 6;</code>
             */

            public Builder putAllProperties(
                    java.util.Map<String, String> values) {
                internalGetMutableProperties().getMutableMap()
                        .putAll(values);
                return this;
            }

            public final Builder setUnknownFields(
                    final com.google.protobuf.UnknownFieldSet unknownFields) {
                return super.setUnknownFieldsProto3(unknownFields);
            }

            public final Builder mergeUnknownFields(
                    final com.google.protobuf.UnknownFieldSet unknownFields) {
                return super.mergeUnknownFields(unknownFields);
            }


            // @@protoc_insertion_point(builder_scope:eventmesh.common.protocol.grpc.BatchMessage.MessageItem)
        }

        // @@protoc_insertion_point(class_scope:eventmesh.common.protocol.grpc.BatchMessage.MessageItem)
        private static final MessageItem DEFAULT_INSTANCE;

        static {
            DEFAULT_INSTANCE = new MessageItem();
        }

        public static MessageItem getDefaultInstance() {
            return DEFAULT_INSTANCE;
        }

        private static final com.google.protobuf.Parser<MessageItem>
                PARSER = new com.google.protobuf.AbstractParser<MessageItem>() {
            public MessageItem parsePartialFrom(
                    com.google.protobuf.CodedInputStream input,
                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                    throws com.google.protobuf.InvalidProtocolBufferException {
                return new MessageItem(input, extensionRegistry);
            }
        };

        public static com.google.protobuf.Parser<MessageItem> parser() {
            return PARSER;
        }

        @Override
        public com.google.protobuf.Parser<MessageItem> getParserForType() {
            return PARSER;
        }

        public MessageItem getDefaultInstanceForType() {
            return DEFAULT_INSTANCE;
        }

    }

    private int bitField0_;
    public static final int HEADER_FIELD_NUMBER = 1;
    private RequestHeader header_;

    /**
     * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
     */
    public boolean hasHeader() {
        return header_ != null;
    }

    /**
     * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
     */
    public RequestHeader getHeader() {
        return header_ == null ? RequestHeader.getDefaultInstance() : header_;
    }

    /**
     * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
     */
    public RequestHeaderOrBuilder getHeaderOrBuilder() {
        return getHeader();
    }

    public static final int PRODUCERGROUP_FIELD_NUMBER = 2;
    private volatile String producerGroup_;

    /**
     * <code>string producerGroup = 2;</code>
     */
    public String getProducerGroup() {
        return producerGroup_;
    }

    /**
     * <code>string producerGroup = 2;</code>
     */
    public com.google.protobuf.ByteString
    getProducerGroupBytes() {
        return ByteString.copyFromUtf8(producerGroup_);
    }

    public static final int TOPIC_FIELD_NUMBER = 3;
    private volatile String topic_;

    /**
     * <code>string topic = 3;</code>
     */
    public String getTopic() {
        return topic_;
    }

    /**
     * <code>string topic = 3;</code>
     */
    public com.google.protobuf.ByteString
    getTopicBytes() {
        return ByteString.copyFromUtf8(topic_);
    }

    public static final int MESSAGEITEM_FIELD_NUMBER = 4;
    private java.util.List<MessageItem> messageItem_;

    /**
     * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
     */
    public java.util.List<MessageItem> getMessageItemList() {
        return messageItem_;
    }

    /**
     * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
     */
    public java.util.List<? extends MessageItemOrBuilder>
    getMessageItemOrBuilderList() {
        return messageItem_;
    }

    /**
     * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
     */
    public int getMessageItemCount() {
        return messageItem_.size();
    }

    /**
     * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
     */
    public MessageItem getMessageItem(int index) {
        return messageItem_.get(index);
    }

    /**
     * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
     */
    public MessageItemOrBuilder getMessageItemOrBuilder(
            int index) {
        return messageItem_.get(index);
    }

    private byte memoizedIsInitialized = -1;

    public final boolean isInitialized() {
        if (memoizedIsInitialized == 1) return true;
        if (memoizedIsInitialized == 0) return false;

        memoizedIsInitialized = 1;
        return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
            throws java.io.IOException {
        if (header_ != null) {
            output.writeMessage(1, getHeader());
        }
        if (!getProducerGroupBytes().isEmpty()) {
            com.google.protobuf.GeneratedMessageV3.writeString(output, 2, producerGroup_);
        }
        if (!getTopicBytes().isEmpty()) {
            com.google.protobuf.GeneratedMessageV3.writeString(output, 3, topic_);
        }
        for (int i = 0; i < messageItem_.size(); i++) {
            output.writeMessage(4, messageItem_.get(i));
        }
        unknownFields.writeTo(output);
    }

    public int getSerializedSize() {
        int size;
        if (memoizedSize != -1) return memoizedSize;
        size = header_ != null ?
                com.google.protobuf.CodedOutputStream.computeMessageSize(1, getHeader()) : 0;
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, producerGroup_);
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, topic_);
        size += messageItem_.stream()
                .mapToInt(messageItem -> com.google.protobuf.CodedOutputStream.computeMessageSize(4, messageItem))
                .sum();
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return memoizedSize;
    }

    @Override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof BatchMessage)) {
            return super.equals(obj);
        }
        BatchMessage other = (BatchMessage) obj;

        return (hasHeader() == other.hasHeader())
                && (hasHeader() ? getHeader().equals(other.getHeader()) : true)
                && getProducerGroup().equals(other.getProducerGroup())
                && getTopic().equals(other.getTopic())
                && getMessageItemList().equals(other.getMessageItemList())
                && unknownFields.equals(other.unknownFields);
    }

    @Override
    public int hashCode() {
        if (memoizedHashCode != 0) {
            return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        if (hasHeader()) {
            hash = (37 * hash) + HEADER_FIELD_NUMBER;
            hash = (53 * hash) + getHeader().hashCode();
        }
        hash = (37 * hash) + PRODUCERGROUP_FIELD_NUMBER;
        hash = (53 * hash) + getProducerGroup().hashCode();
        hash = (37 * hash) + TOPIC_FIELD_NUMBER;
        hash = (53 * hash) + getTopic().hashCode();
        if (getMessageItemCount() > 0) {
            hash = (37 * hash) + MESSAGEITEM_FIELD_NUMBER;
            hash = (53 * hash) + getMessageItemList().hashCode();
        }
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
    }

    public static BatchMessage parseFrom(
            java.nio.ByteBuffer data)
            throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static BatchMessage parseFrom(
            java.nio.ByteBuffer data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static BatchMessage parseFrom(
            com.google.protobuf.ByteString data)
            throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static BatchMessage parseFrom(
            com.google.protobuf.ByteString data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static BatchMessage parseFrom(byte[] data)
            throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static BatchMessage parseFrom(
            byte[] data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static BatchMessage parseFrom(java.io.InputStream input)
            throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input);
    }

    public static BatchMessage parseFrom(
            java.io.InputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input, extensionRegistry);
    }

    public static BatchMessage parseDelimitedFrom(java.io.InputStream input)
            throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
                .parseDelimitedWithIOException(PARSER, input);
    }

    public static BatchMessage parseDelimitedFrom(
            java.io.InputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
                .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }

    public static BatchMessage parseFrom(
            com.google.protobuf.CodedInputStream input)
            throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input);
    }

    public static BatchMessage parseFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input, extensionRegistry);
    }

    public Builder newBuilderForType() {
        return newBuilder();
    }

    public static Builder newBuilder() {
        return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(BatchMessage prototype) {
        return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    public Builder toBuilder() {
        return this == DEFAULT_INSTANCE
                ? new Builder() : new Builder().mergeFrom(this);
    }

    @Override
    protected Builder newBuilderForType(
            BuilderParent parent) {
        Builder builder = new Builder(parent);
        return builder;
    }

    /**
     * Protobuf type {@code eventmesh.common.protocol.grpc.BatchMessage}
     */
    public static final class Builder extends
            com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
            // @@protoc_insertion_point(builder_implements:eventmesh.common.protocol.grpc.BatchMessage)
            BatchMessageOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
            return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_descriptor;
        }

        protected FieldAccessorTable
        internalGetFieldAccessorTable() {
            return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_fieldAccessorTable
                    .ensureFieldAccessorsInitialized(
                            BatchMessage.class, Builder.class);
        }

        // Construct using org.apache.eventmesh.common.protocol.grpc.protos.BatchMessage.newBuilder()
        private Builder() {
            maybeForceBuilderInitialization();
        }

        private Builder(BuilderParent parent) {
            super(parent);
            maybeForceBuilderInitialization();
        }

        private void maybeForceBuilderInitialization() {
            if (com.google.protobuf.GeneratedMessageV3
                    .alwaysUseFieldBuilders) {
                getMessageItemFieldBuilder();
            }
        }

        public Builder clear() {
            super.clear();
            if (headerBuilder_ == null) {
                header_ = null;
            } else {
                header_ = null;
                headerBuilder_ = null;
            }
            producerGroup_ = "";

            topic_ = "";

            if (messageItemBuilder_ == null) {
                messageItem_ = java.util.Collections.emptyList();
                bitField0_ = (bitField0_ & ~0x00000008);
            } else {
                messageItemBuilder_.clear();
            }
            return this;
        }

        public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
            return EventmeshGrpc.internal_static_eventmesh_common_protocol_grpc_BatchMessage_descriptor;
        }

        public BatchMessage getDefaultInstanceForType() {
            return BatchMessage.getDefaultInstance();
        }

        public BatchMessage build() {
            BatchMessage result = buildPartial();
            if (!result.isInitialized()) {
                throw newUninitializedMessageException(result);
            }
            return result;
        }

        public BatchMessage buildPartial() {
            BatchMessage result = new BatchMessage(this);
            int from_bitField0_ = bitField0_;
            int to_bitField0_ = 0;
            if (headerBuilder_ == null) {
                result.header_ = header_;
            } else {
                result.header_ = headerBuilder_.build();
            }
            result.producerGroup_ = producerGroup_;
            result.topic_ = topic_;
            if (messageItemBuilder_ == null) {
                if (((bitField0_ & 0x00000008) == 0x00000008)) {
                    messageItem_ = java.util.Collections.unmodifiableList(messageItem_);
                    bitField0_ = (bitField0_ & ~0x00000008);
                }
                result.messageItem_ = messageItem_;
            } else {
                result.messageItem_ = messageItemBuilder_.build();
            }
            result.bitField0_ = to_bitField0_;
            onBuilt();
            return result;
        }

        public Builder clone() {
            return (Builder) super.clone();
        }

        public Builder setField(
                com.google.protobuf.Descriptors.FieldDescriptor field,
                Object value) {
            return (Builder) super.setField(field, value);
        }

        public Builder clearField(
                com.google.protobuf.Descriptors.FieldDescriptor field) {
            return (Builder) super.clearField(field);
        }

        public Builder clearOneof(
                com.google.protobuf.Descriptors.OneofDescriptor oneof) {
            return (Builder) super.clearOneof(oneof);
        }

        public Builder setRepeatedField(
                com.google.protobuf.Descriptors.FieldDescriptor field,
                int index, Object value) {
            return (Builder) super.setRepeatedField(field, index, value);
        }

        public Builder addRepeatedField(
                com.google.protobuf.Descriptors.FieldDescriptor field,
                Object value) {
            return (Builder) super.addRepeatedField(field, value);
        }

        public Builder mergeFrom(com.google.protobuf.Message other) {
            if (other instanceof BatchMessage) {
                return mergeFrom((BatchMessage) other);
            } else {
                super.mergeFrom(other);
                return this;
            }
        }

        public Builder mergeFrom(BatchMessage other) {
            if (other == BatchMessage.getDefaultInstance()) return this;
            if (other.hasHeader()) {
                mergeHeader(other.getHeader());
            }
            if (!other.getProducerGroup().isEmpty()) {
                producerGroup_ = other.producerGroup_;
                onChanged();
            }
            if (!other.getTopic().isEmpty()) {
                topic_ = other.topic_;
                onChanged();
            }
            if (messageItemBuilder_ == null) {
                if (!other.messageItem_.isEmpty()) {
                    if (messageItem_.isEmpty()) {
                        messageItem_ = other.messageItem_;
                        bitField0_ = (bitField0_ & ~0x00000008);
                    } else {
                        ensureMessageItemIsMutable();
                        messageItem_.addAll(other.messageItem_);
                    }
                    onChanged();
                }
            } else {
                if (!other.messageItem_.isEmpty()) {
                    if (messageItemBuilder_.isEmpty()) {
                        messageItemBuilder_.dispose();
                        messageItemBuilder_ = null;
                        messageItem_ = other.messageItem_;
                        bitField0_ = (bitField0_ & ~0x00000008);
                        messageItemBuilder_ =
                                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                                        getMessageItemFieldBuilder() : null;
                    } else {
                        messageItemBuilder_.addAllMessages(other.messageItem_);
                    }
                }
            }
            this.mergeUnknownFields(other.unknownFields);
            onChanged();
            return this;
        }

        public final boolean isInitialized() {
            return true;
        }

        public Builder mergeFrom(
                com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException {
            BatchMessage parsedMessage = null;
            try {
                parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                parsedMessage = (BatchMessage) e.getUnfinishedMessage();
                throw e.unwrapIOException();
            } finally {
                if (parsedMessage != null) {
                    mergeFrom(parsedMessage);
                }
            }
            return this;
        }

        private int bitField0_;

        private RequestHeader header_ = null;
        private com.google.protobuf.SingleFieldBuilderV3<
                RequestHeader, RequestHeader.Builder, RequestHeaderOrBuilder> headerBuilder_;

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public boolean hasHeader() {
            return headerBuilder_ != null || header_ != null;
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public RequestHeader getHeader() {
            if (headerBuilder_ == null) {
                return header_ == null ? RequestHeader.getDefaultInstance() : header_;
            } else {
                return headerBuilder_.getMessage();
            }
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public Builder setHeader(RequestHeader value) {
            if (headerBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                header_ = value;
                onChanged();
            } else {
                headerBuilder_.setMessage(value);
            }

            return this;
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public Builder setHeader(
                RequestHeader.Builder builderForValue) {
            if (headerBuilder_ == null) {
                header_ = builderForValue.build();
                onChanged();
            } else {
                headerBuilder_.setMessage(builderForValue.build());
            }

            return this;
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public Builder mergeHeader(RequestHeader value) {
            if (headerBuilder_ == null) {
                if (header_ != null) {
                    header_ =
                            RequestHeader.newBuilder(header_).mergeFrom(value).buildPartial();
                } else {
                    header_ = value;
                }
                onChanged();
            } else {
                headerBuilder_.mergeFrom(value);
            }

            return this;
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public Builder clearHeader() {
            if (headerBuilder_ == null) {
                header_ = null;
                onChanged();
            } else {
                header_ = null;
                headerBuilder_ = null;
            }

            return this;
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public RequestHeader.Builder getHeaderBuilder() {

            onChanged();
            return getHeaderFieldBuilder().getBuilder();
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        public RequestHeaderOrBuilder getHeaderOrBuilder() {
            if (headerBuilder_ != null) {
                return headerBuilder_.getMessageOrBuilder();
            } else {
                return header_ == null ?
                        RequestHeader.getDefaultInstance() : header_;
            }
        }

        /**
         * <code>.eventmesh.common.protocol.grpc.RequestHeader header = 1;</code>
         */
        private com.google.protobuf.SingleFieldBuilderV3<
                RequestHeader, RequestHeader.Builder, RequestHeaderOrBuilder>
        getHeaderFieldBuilder() {
            if (headerBuilder_ == null) {
                headerBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
                        RequestHeader, RequestHeader.Builder, RequestHeaderOrBuilder>(
                        getHeader(),
                        getParentForChildren(),
                        isClean());
                header_ = null;
            }
            return headerBuilder_;
        }

        private String producerGroup_ = "";

        /**
         * <code>string producerGroup = 2;</code>
         */
        public String getProducerGroup() {
            return producerGroup_;
        }

        /**
         * <code>string producerGroup = 2;</code>
         */
        public com.google.protobuf.ByteString
        getProducerGroupBytes() {
            return ByteString.copyFromUtf8(producerGroup_);
        }

        /**
         * <code>string producerGroup = 2;</code>
         */
        public Builder setProducerGroup(
                String value) {
            Objects.requireNonNull(value, "ProducerGroup can not be null");

            producerGroup_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string producerGroup = 2;</code>
         */
        public Builder clearProducerGroup() {

            producerGroup_ = getDefaultInstance().getProducerGroup();
            onChanged();
            return this;
        }

        /**
         * <code>string producerGroup = 2;</code>
         */
        public Builder setProducerGroupBytes(
                com.google.protobuf.ByteString value) {
            Objects.requireNonNull(value, "ProducerGroupBytes can not be null");
            checkByteStringIsUtf8(value);

            producerGroup_ = value.toStringUtf8();
            onChanged();
            return this;
        }

        private String topic_ = "";

        /**
         * <code>string topic = 3;</code>
         */
        public String getTopic() {
            return topic_;
        }

        /**
         * <code>string topic = 3;</code>
         */
        public com.google.protobuf.ByteString
        getTopicBytes() {
            return ByteString.copyFromUtf8(topic_);
        }

        /**
         * <code>string topic = 3;</code>
         */
        public Builder setTopic(
                String value) {
            Objects.requireNonNull(value, "Topic can not be null");

            topic_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string topic = 3;</code>
         */
        public Builder clearTopic() {

            topic_ = getDefaultInstance().getTopic();
            onChanged();
            return this;
        }

        /**
         * <code>string topic = 3;</code>
         */
        public Builder setTopicBytes(
                com.google.protobuf.ByteString value) {
            Objects.requireNonNull(value, "TopicBytes can not be null");
            checkByteStringIsUtf8(value);

            topic_ = value.toStringUtf8();
            onChanged();
            return this;
        }

        private java.util.List<MessageItem> messageItem_ =
                java.util.Collections.emptyList();

        private void ensureMessageItemIsMutable() {
            if (!((bitField0_ & 0x00000008) == 0x00000008)) {
                messageItem_ = new java.util.ArrayList<MessageItem>(messageItem_);
                bitField0_ |= 0x00000008;
            }
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                MessageItem, MessageItem.Builder, MessageItemOrBuilder> messageItemBuilder_;

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public java.util.List<MessageItem> getMessageItemList() {
            if (messageItemBuilder_ == null) {
                return java.util.Collections.unmodifiableList(messageItem_);
            } else {
                return messageItemBuilder_.getMessageList();
            }
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public int getMessageItemCount() {
            if (messageItemBuilder_ == null) {
                return messageItem_.size();
            } else {
                return messageItemBuilder_.getCount();
            }
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public MessageItem getMessageItem(int index) {
            if (messageItemBuilder_ == null) {
                return messageItem_.get(index);
            } else {
                return messageItemBuilder_.getMessage(index);
            }
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder setMessageItem(
                int index, MessageItem value) {
            if (messageItemBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureMessageItemIsMutable();
                messageItem_.set(index, value);
                onChanged();
            } else {
                messageItemBuilder_.setMessage(index, value);
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder setMessageItem(
                int index, MessageItem.Builder builderForValue) {
            if (messageItemBuilder_ == null) {
                ensureMessageItemIsMutable();
                messageItem_.set(index, builderForValue.build());
                onChanged();
            } else {
                messageItemBuilder_.setMessage(index, builderForValue.build());
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder addMessageItem(MessageItem value) {
            if (messageItemBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureMessageItemIsMutable();
                messageItem_.add(value);
                onChanged();
            } else {
                messageItemBuilder_.addMessage(value);
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder addMessageItem(
                int index, MessageItem value) {
            if (messageItemBuilder_ == null) {
                if (value == null) {
                    throw new NullPointerException();
                }
                ensureMessageItemIsMutable();
                messageItem_.add(index, value);
                onChanged();
            } else {
                messageItemBuilder_.addMessage(index, value);
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder addMessageItem(
                MessageItem.Builder builderForValue) {
            if (messageItemBuilder_ == null) {
                ensureMessageItemIsMutable();
                messageItem_.add(builderForValue.build());
                onChanged();
            } else {
                messageItemBuilder_.addMessage(builderForValue.build());
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder addMessageItem(
                int index, MessageItem.Builder builderForValue) {
            if (messageItemBuilder_ == null) {
                ensureMessageItemIsMutable();
                messageItem_.add(index, builderForValue.build());
                onChanged();
            } else {
                messageItemBuilder_.addMessage(index, builderForValue.build());
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder addAllMessageItem(
                Iterable<? extends MessageItem> values) {
            if (messageItemBuilder_ == null) {
                ensureMessageItemIsMutable();
                com.google.protobuf.AbstractMessageLite.Builder.addAll(
                        values, messageItem_);
                onChanged();
            } else {
                messageItemBuilder_.addAllMessages(values);
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder clearMessageItem() {
            if (messageItemBuilder_ == null) {
                messageItem_ = java.util.Collections.emptyList();
                bitField0_ = (bitField0_ & ~0x00000008);
                onChanged();
            } else {
                messageItemBuilder_.clear();
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public Builder removeMessageItem(int index) {
            if (messageItemBuilder_ == null) {
                ensureMessageItemIsMutable();
                messageItem_.remove(index);
                onChanged();
            } else {
                messageItemBuilder_.remove(index);
            }
            return this;
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public MessageItem.Builder getMessageItemBuilder(
                int index) {
            return getMessageItemFieldBuilder().getBuilder(index);
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public MessageItemOrBuilder getMessageItemOrBuilder(
                int index) {
            if (messageItemBuilder_ == null) {
                return messageItem_.get(index);
            } else {
                return messageItemBuilder_.getMessageOrBuilder(index);
            }
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public java.util.List<? extends MessageItemOrBuilder>
        getMessageItemOrBuilderList() {
            if (messageItemBuilder_ != null) {
                return messageItemBuilder_.getMessageOrBuilderList();
            } else {
                return java.util.Collections.unmodifiableList(messageItem_);
            }
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public MessageItem.Builder addMessageItemBuilder() {
            return getMessageItemFieldBuilder().addBuilder(
                    MessageItem.getDefaultInstance());
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public MessageItem.Builder addMessageItemBuilder(
                int index) {
            return getMessageItemFieldBuilder().addBuilder(
                    index, MessageItem.getDefaultInstance());
        }

        /**
         * <code>repeated .eventmesh.common.protocol.grpc.BatchMessage.MessageItem messageItem = 4;</code>
         */
        public java.util.List<MessageItem.Builder>
        getMessageItemBuilderList() {
            return getMessageItemFieldBuilder().getBuilderList();
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                MessageItem, MessageItem.Builder, MessageItemOrBuilder>
        getMessageItemFieldBuilder() {
            if (messageItemBuilder_ == null) {
                messageItemBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
                        MessageItem, MessageItem.Builder, MessageItemOrBuilder>(
                        messageItem_,
                        ((bitField0_ & 0x00000008) == 0x00000008),
                        getParentForChildren(),
                        isClean());
                messageItem_ = null;
            }
            return messageItemBuilder_;
        }

        public final Builder setUnknownFields(
                final com.google.protobuf.UnknownFieldSet unknownFields) {
            return super.setUnknownFieldsProto3(unknownFields);
        }

        public final Builder mergeUnknownFields(
                final com.google.protobuf.UnknownFieldSet unknownFields) {
            return super.mergeUnknownFields(unknownFields);
        }


        // @@protoc_insertion_point(builder_scope:eventmesh.common.protocol.grpc.BatchMessage)
    }

    // @@protoc_insertion_point(class_scope:eventmesh.common.protocol.grpc.BatchMessage)
    private static final BatchMessage DEFAULT_INSTANCE;

    static {
        DEFAULT_INSTANCE = new BatchMessage();
    }

    public static BatchMessage getDefaultInstance() {
        return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<BatchMessage>
            PARSER = new com.google.protobuf.AbstractParser<BatchMessage>() {
        public BatchMessage parsePartialFrom(
                com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException {
            return new BatchMessage(input, extensionRegistry);
        }
    };

    public static com.google.protobuf.Parser<BatchMessage> parser() {
        return PARSER;
    }

    @Override
    public com.google.protobuf.Parser<BatchMessage> getParserForType() {
        return PARSER;
    }

    public BatchMessage getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
    }

}

